import java.io.Serializable;

public class ProcessInfo implements Comparable<ProcessInfo>, Serializable {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 6765081223497318940L;
	private String id;
	private double time;
	private Broadcast broadcast;
	private Processor senderProcessor;
	
	public ProcessInfo(String id, double time, Broadcast broadcast,Processor senderProcessor) {
		this.id = id;
		this.time = time;
		this.broadcast = broadcast;
		this.setSenderProcessor(senderProcessor);
	}
	
	public double getTime() {
		return time;
	}
	public void setTime(double time) {
		this.time = time;
	}
	public Broadcast getBroadcast() {
		return broadcast;
	}
	public void setBroadcast(Broadcast broadcast) {
		this.broadcast = broadcast;
	}
	
	@Override
	public int compareTo(ProcessInfo o) {
		final int BEFORE = -1;
	    final int EQUAL = 0;
	    final int AFTER = 1;
	    
	    if(this.time == o.time) {
	    	return EQUAL;
	    }else if(this.time < o.time) {
	    	return BEFORE;
	    }else {
	    	return AFTER;
	    }
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public Processor getSenderProcessor() {
		return senderProcessor;
	}

	public void setSenderProcessor(Processor senderProcessor) {
		this.senderProcessor = senderProcessor;
	}
	
}
